<?php
  header("Content-type:text/html;charset=utf-8");
  $id = $_GET["id"];
  $conn = mysql_connect("localhost","root","root");
  mysql_select_db("database_phone");
  $result1 = mysql_query("select * from phone where id = '$id'",$conn);
  if(mysql_num_rows($result1) == 1){
    $rows = mysql_fetch_assoc($result1);
    echo $rows["series"];
    echo ";";
    echo $rows["pname"];
    echo ";";
    echo $rows["ptype"];
    echo "&";
  }
  //获取所有图片
  $result2 = mysql_query("select * from pimg left join phone on pimg.pphoneid = phone.id where phone.id = '$id'",$conn);
  while($rows = mysql_fetch_assoc($result2)){
    echo $rows["pimg"];
    echo ";";
  }
  echo "&";
  //获取所有颜色
  $result3 = mysql_query("select * from pcolor left join phone on pcolor.pphoneid = phone.id where phone.id = '$id'", $conn);
  while ($rows = mysql_fetch_assoc($result3)) {
    echo $rows["pcolor"];
    echo ";";
  }
  echo "&";
  //获取所有内存
  $result4 = mysql_query("select * from storage2phone sp left join pstorage on sp.pstorageid = pstorage.id left join phone on sp.pphoneid = phone.id where phone.id = '$id'", $conn);
  while ($rows = mysql_fetch_assoc($result4)){
    echo $rows["pstorage"];
    echo ";";
  }
  echo "&";
  //获取所有价格
  $result5 = mysql_query("select * from pprice left join phone on pprice.pphoneid = phone.id where phone.id = '$id'",$conn);
  while($rows = mysql_fetch_assoc($result5)){
    echo $rows["pprice"];
    echo ";";
  }
  mysql_close($conn);
?>
